import request from '@/utils/request'//引入，封装了axios

export default{
  //1.讲师列表(条件查询分页)
  //current 当前页 limit 每页的记录数  teacherQuery 条件对象
  getTeacherListPage(current,limit,teacherQuery){
    return request({
      // url: '/eduservice/teacher/pageTeacherCondition/'+current+"/"+limit,
      url:`/eduservice/teacher/pageTeacherCondition/${current}/${limit}`,//建议使用这种方法
      method: 'post',
      //teacherQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转化成json进行传递到接口里面
      data:teacherQuery
    })
  },
  //删除讲师
  deleteTeacherId(id){
    return request({
      // url: '/eduservice/teacher/'+id,
      url:`/eduservice/teacher/${id}`,//建议使用这种方法
      method: 'delete'

    })
   },
   //添加讲师
   addTeacher(teacher){
    return request({
      url:`/eduservice/teacher/addTeacher`,
      method: 'post',
      data:teacher
    })
  },
  //根据ID查询讲师
  getTeacherInfo(id){
    return request({
      url:`/eduservice/teacher/getTeacherId/${id}`,//建议使用这种方法
      method: 'get'
    })
  },
  //修改讲师
  updateTeacherInfo(teacher){
    return request({
      url:`/eduservice/teacher/updateTeacher`,//建议使用这种方法
      method: 'post',
      data:teacher
    })
  }
}
